<?php
	require_once('config.php');
	include "fpdf/fpdf.php";

ini_set('error_reporting', E_ALL ^ E_NOTICE);
ini_set('display_errors', '0');

$tgl = $_POST['bulan'];
$tglx = date('d-M-Y');
$pdf = new FPDF();
$pdf->Open();
$pdf->addPage();
$pdf->setAutoPageBreak(false);
$pdf->setFont('Arial','',12);
$pdf->text(60,30,'LAPORAN BULANAN BAHAN BAKU MASUK CUP');
$pdf->text(85,36,'');
$yi = 46;
$ya = 44;
$pdf->setFont('Arial','',9);
$pdf->setFillColor(222,222,222);
$pdf->setXY(18,40);
$pdf->CELL(6,6,'NO',1,0,'C',1);
$pdf->CELL(45,6,'NAMA SUPLIER',1,0,'C',1);
$pdf->CELL(30,6,'KODE BARANG',1,0,'C',1);
$pdf->CELL(30,6,'NAMA BARANG',1,0,'C',1);
$pdf->CELL(30,6,'JUMLAH MASUK',1,0,'C',1);
$pdf->CELL(40,6,'TANGGAL MASUK',1,0,'C',1);

$ya = $yi + $row;
$sql=mysql_query("select * from tb_bb a,tb_suplier b where a.id_suplier=b.id_suplier
 and MONTH(a.tgl_masuk)='$tgl'");
$i = 1;
$no = 1;
$max = 31;
$row = 6;
while($data = mysql_fetch_array($sql)){
$pdf->setXY(18,$ya);
$pdf->setFont('arial','',9);
$pdf->setFillColor(255,255,255);
$pdf->cell(6,6,$no,1,0,'C',1);
$pdf->cell(45,6,$data["nama"],1,0,'L',1);
$pdf->cell(30,6,$data["kode_bb"],1,0,'L',1);
$pdf->cell(30,6,$data["nama_bb"],1,0,'L',1);
$pdf->CELL(30,6,$data["jumlah"],1,0,'C',1);
$pdf->CELL(40,6,$data["tgl_masuk"],1,0,'C',1);
$ya = $ya+$row;
$no++;
$i++;
//$dm[kode] = $data[kdprog];
}
$pdf->text(140,$ya+20,"BOJONEGORO , ".$tglx);
$pdf->text(153,$ya+40,"PIMPINAN");
$pdf->output();
?>